﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using SangsTools;

public class UIMainMenu : SingletonMono<UIMainMenu>
{
    [SerializeField]
    protected Transform tfLoading;
    [SerializeField]
    protected Transform tfMenu;

    private void Awake()
    {
        tfLoading.gameObject.SetActive(true);
        tfMenu.gameObject.SetActive(false);

        tfMenu.GetComponentInChildren<UnityEngine.UI.Button>().onClick.AddListener(OnStartBtnClickAsync);
    }

    public void LoadOver()
    {
        tfLoading.gameObject.SetActive(false);
        tfMenu.gameObject.SetActive(true);
    }

    private async void OnStartBtnClickAsync()
    {
        gameObject.SetActive(false);

        await System.Threading.Tasks.Task.Delay(1000);

        Battle.LevelScriptMgr.NextLevel();
    }
}
